<?php

class Web_Wgt_Banner
{

    public function render()
    {
        $this->add_css_link(BASE_WEB_ROOT . '/css/pirobox_style_2/style.css');
        $this->add_js_link(BASE_WEB_ROOT . '/js/jquery-ui-1.8.2.custom.min.js');
        $this->add_js_link(BASE_WEB_ROOT . '/js/pirobox_extended_min.js');
        $this->add_js_link(BASE_WEB_ROOT . '/js/jquery.bxSlider.js');

        $obj = new Web_Db_Banner();
        $db = $obj->getAdapter();
        $rs = $db->fetchAll($obj->select()
                ->from('ma_banner', array('ba_id', 'ba_titulo'))
                ->where('ba_estado=?', 1)
                ->order('ba_fecha_update DESC'));
        
//        print_r($rs);

        $smarty = new Smarty_Engine();
        $smarty->assign('banners', $rs);

        return $smarty->fetch(TPL_ROOT . DS . 'wgt-banner.tpl');
    }

}